

package com.dog.basics.sys.controller;

import cn.hutool.json.JSONArray;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.R;
import com.dog.basics.service.sys.SysRouteConfService;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 路由
 *
 * @author guonh
 * @date 2018-11-06 10:17:18
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/route")
@Api(value = "动态路由管理模块", tags = "动态路由管理模块")
@ApiIgnore
public class SysRouteConfController {

    private final SysRouteConfService sysRouteConfService;

    /**
     * 获取当前定义的路由信息
     *
     * @return
     */
    @GetMapping
    public R listRoutes() {
        return R.ok(sysRouteConfService.list());
    }

    /**
     * 修改路由
     *
     * @param routes 路由定义
     * @return
     */
    @SysLog("修改路由")
    @PutMapping
    public R updateRoutes(@RequestBody JSONArray routes) {
        return R.ok(sysRouteConfService.updateRoutes(routes));
    }

}
